package commands;

import bot.CommandBot;

public class Quit implements Command {

	public String getCommandName() {
		return "quit";
	}

	public boolean execCommand(String channel, String sender, String login,
			String hostname, String message, CommandBot bot) {
		if (message.equals("")) {
			return exit(bot, login);
		}
		return false;
	}

	@Override
	public boolean execCommand(String sender, String login, String hostname,
			String message, CommandBot bot) {
		if (message.equals("")) {
			return exit(bot, login);
		}
		return false;
	}

	public boolean exit(CommandBot bot, String login) {
		if (((CommandBot) bot).getMaster().checkMaster(login)) {
			bot.quitServer("Bye bye!");
			System.exit(0);
		}
		return true;
	}
}
